import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int []n = new int[100];
        int target = in.nextInt();
        for(int i = 0 ; i < 4; i ++){
            n[i] = in.nextInt();
        }
        for(int j = 0 ; j < n.length ; j ++){
            for(int k = j+1 ; k < n.length ; k ++){
                if(n[j] + n[k]==target){
                    System.out.println(j+","+k);
                    j=j++;
                }
            }
        }
    }
}
